const path = require('path');
var library = "Validate";
var config = {
    optimization: {
        minimize: true
    },
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        libraryTarget: 'umd',
        library: library,
        filename: `${library}.min.js`,
        umdNamedDefine: true
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use: {
                    loader: 'babel-loader'
                }
            }
        ]
    }
}
module.exports = (env, argv) => {
    if (argv.mode === 'development') {
        config.devtool = 'source-map';
        config.output.filename = `${library}.js`;
        config.optimization.minimize = false;
    }
    return config;
}